package com.caiyi.financial.nirvana.sms.controller;

import com.caiyi.financial.nirvana.sms.entity.SmsAccountBlacklist;
import com.caiyi.financial.nirvana.sms.querybean.QueryAccountBlacklistBean;
import com.caiyi.financial.nirvana.sms.service.SmsAccountBlacklistService;
import com.youyu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(description = "账户黑名单管理")
@RestController
@CrossOrigin
@RequestMapping("sms/admin/accountBlacklist")
public class AccountBlacklistController {

    @Autowired
    private SmsAccountBlacklistService accountBlacklistService;

    @ApiOperation(value = "添加AccountBlacklist详情", notes = "添加AccountBlacklist详情描述")
    @ApiImplicitParam(name = "smsAccountBlacklist", value = "账号黑名单", required = true, dataType = "SmsAccountBlacklist")
    @PostMapping("/addAccountBlacklist")
    public Result addAccountBlacklist(@RequestBody SmsAccountBlacklist smsAccountBlacklist) {
        return Result.ok(accountBlacklistService.addAccountBlacklist(smsAccountBlacklist));
    }

    @ApiOperation(value = "删除AccountBlacklist详情", notes = "删除AccountBlacklist")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "名单id", dataType = "int", paramType = "query", required = true)})
    @PostMapping("/deleteAccountBlacklist")
    public Result deleteAccountBlacklist(Integer id) {
        return Result.ok(accountBlacklistService.deleteAccountBlacklist(id));
    }

    @ApiOperation(value = "更新AccountBlacklist详情", notes = "更新AccountBlacklist")
    @ApiImplicitParam(name = "smsAccountBlacklist", value = "账号黑名单", required = true, dataType = "SmsAccountBlacklist")
    @PostMapping("/updateAccountBlacklist")
    public Result updateAccountBlacklist(@RequestBody SmsAccountBlacklist smsAccountBlacklist) {
        return Result.ok(accountBlacklistService.updateAccountBlacklist(smsAccountBlacklist));
    }

    @ApiOperation(value = "根据params查找AccountBlacklist详情", notes = "根据params查找AccountBlacklist详情描述")
    @ApiImplicitParams({@ApiImplicitParam(name = "bean", value = "查找黑名单参数", dataType = "QueryAccountBlacklistBean", paramType = "body")})
    @PostMapping("/getAccountBlacklistByParams")
    public Result getAccountBlacklistByParams(@RequestBody QueryAccountBlacklistBean bean) {
        return Result.ok(accountBlacklistService.getAccountBlacklistByParams(bean));
    }

}
